<template>
  <section>
    <el-form :model="fromData" status-icon :rules="fromData_rules" ref="fromDataRef" label-width="100px">
      <el-form-item label="工程名称" prop="name">
        <el-input v-model="fromData.name"></el-input>
      </el-form-item>
      <el-form-item label="工程编号" prop="code">
        <el-input :readonly="templateType == 'set'" v-model="fromData.code"></el-input>
      </el-form-item>
      <el-form-item label="委托单位" prop="entrustingParty">
        <el-input :readonly="templateType == 'set'" v-model="fromData.entrustingParty"></el-input>
      </el-form-item>
      <el-form-item label="委托测量员" v-if="fromData.surveyManagerName">
        <el-tooltip placement="bottom">
          <div slot="content" class="w100">
            <div v-for="(item, index) in fromData.surveyManagerName.split(',')" :key="index">{{ item }}</div>
          </div>
          <el-button class="w100">{{ fromData.surveyManagerName.split(',').length - 1 + '个测量员关联' }}</el-button>
        </el-tooltip>
      </el-form-item>
      <el-form-item label="监理单位" prop="supervisingUnit">
        <el-input :readonly="templateType == 'set'" v-model="fromData.supervisingUnit"></el-input>
      </el-form-item>
      <el-form-item label="隧道名称" prop="tunnelName">
        <el-input :readonly="templateType == 'set'" v-model="fromData.tunnelName"></el-input>
      </el-form-item>
      <el-form-item label="围岩级别" prop="surroundingRockClassification">
        <el-input :readonly="templateType == 'set'" v-model="fromData.surroundingRockClassification"></el-input>
      </el-form-item>
      <el-form-item label="仪器型号" prop="instrumentModel">
        <el-input :readonly="templateType == 'set'" v-model="fromData.instrumentModel"></el-input>
      </el-form-item>
      <el-form-item label="断面里程" prop="sectionMileage">
        <el-input :readonly="templateType == 'set'" v-model="fromData.sectionMileage"></el-input>
      </el-form-item>
      <el-form-item label="埋设日期" prop="embeddingDate">
        <el-input :readonly="templateType == 'set'" v-model="fromData.embeddingDate"></el-input>
      </el-form-item>
      <el-form-item label="预留变形量" prop="reservedDeformation">
        <el-input :readonly="templateType == 'set'" v-model="fromData.reservedDeformation"></el-input>
      </el-form-item>
      <el-form-item label="控制点" prop="controlPoint">
        <el-input :readonly="templateType == 'set'" v-model="fromData.controlPoint"></el-input>
      </el-form-item>
      <el-form-item label="依据标准" prop="standard">
        <el-input :readonly="templateType == 'set'" v-model="fromData.standard"></el-input>
      </el-form-item>
    </el-form>
    <div></div>
  </section>
</template>

<script>
export default {
  props: {
    fromData: {},
    templateType: null,
  },
  data() {
    return {
      fromData_rules: { name: [{ required: true, message: '请输入工程名称', trigger: ['blur', 'change'] }] },
    }
  },
  methods: {
    validate() {
      let res_bool = false
      this.$refs.fromDataRef.validate(bool => {
        res_bool = bool
      })
      return res_bool
    },
    resetFields() {
      this.$refs.fromDataRef.resetFields()
    },
  },
}
</script>

<style>
</style>